refactor(chat): migrate to scoped web components - #6933
Draft
RSS1102 wants to merge 16 commits into
Draft
Conversation
16 tasks
Contributor
|
Size Change: 0 B Total Size: 21.4 kB ℹ️ View Unchanged
|
Contributor
|
Size Change: 0 B Total Size: 3.55 kB ℹ️ View Unchanged
|
Contributor
|
Size Change: -65 B (-0.09%) Total Size: 74.8 kB 📦 View Changed
ℹ️ View Unchanged
|
commit: |
Contributor
|
Size Change: 0 B Total Size: 960 kB ℹ️ View Unchanged
|
Collaborator
TDesign Component Site Preview Open
|
Merged
16 tasks
RSS1102
marked this pull request as ready for review
August 25, 2026 10:18
RSS1102
requested review from
Cat1007,
PengYYYYY,
Wesley-0808,
chaishi,
liweijie0812,
uyarn,
zhangpaopao0609 and
zydemail
as code owners
August 25, 2026 10:18
RSS1102
marked this pull request as draft
August 25, 2026 10:18
RSS1102
marked this pull request as ready for review
August 25, 2026 10:21
RSS1102
marked this pull request as draft
August 25, 2026 10:25
RSS1102
marked this pull request as ready for review
August 26, 2026 02:49
RSS1102
marked this pull request as ready for review
August 26, 2026 04:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🤔 这个 PR 的性质是?
🧪 A/B 测试
两组 StackBlitz 使用相同的 Vue 源码和 AGUI 事件,只切换
@tdesign-vue-next/chat:@tdesign-vue-next/chat@0.6.0a52eb9e预览包两边都只声明
@tdesign-vue-next/chat,没有额外安装或别名覆盖 Web Components。测试通过useChat创建 ChatEngine,再显式放入 Vue 深层ref,连续发送两个THINKING_TEXT_MESSAGE_CONTENT。isReactive(engine)@tdesign-vue-next/chat@0.6.0trueTypeError,思考过程渲染中断a52eb9etruecomplete,思考文本为第一段第二段,no error🔗 相关 PR
💡 需要修复的问题
AGUI 思考过程流式输出中断
@tdesign-vue-next/chat@0.6.0使用旧的tdesign-web-components单包。旧实现会让 mapper 持有的 reasoning 数据与 Immer message store 共享对象。第一个 CONTENT 写入 store 后对象被冻结,第二个 CONTENT 再通过 Vue 深层 Proxy 读取时违反 Proxy invariant,最终抛出TypeError。Vue Chat 仍依赖旧 WebC 物理路径
运行时和类型通过
tdesign-web-components/lib/...导入,无法直接消费分包后的公共 API,也与旧目录结构强耦合。上传附件缺少稳定的状态边界
公开
Chatbot.sendUserMessage()接收的附件可能包含 Vue Proxy、File和上传响应等业务对象。原对象直接进入 ChatEngine 状态后,可能被 Immer 冻结,并把上传过程字段带入内部消息状态。✅ 修复情况
当前 PR 主要修复什么
本 PR 负责 Vue Chat 对 scoped WebC 的迁移和接入:
tdesign-web-components依赖替换为@tdesign/web-components和@tdesign/web-components-chat;lib/...物理路径;UploadActionType,统一复用 WebC Chat Sender 类型;useChat的深层ref行为,用 A/B 验证确认修复来自新的 ChatEngine 数据流,而不是通过shallowRef绕开问题。分包后的 ChatEngine 不再在后续事件中读取已被 Immer 冻结的共享 reasoning 数组。每个 CONTENT 使用独立 delta,并在 message store 内完成合并,因此连续思考事件不会再触发原异常链路。
TDesignOteam/tdesign-web-components#418 的作用和必要性
TDesignOteam/tdesign-web-components#418 修复公开
Chatbot.sendUserMessage()的附件 DTO 边界:进入 ChatEngine 前创建新的附件数组和 item,只保留协议字段,不把raw、response等上传过程对象写入内部状态,同时保持metadata的既有语义。a6899156不可变预览因此,TDesignOteam/tdesign-web-components#418 不是 THINKING 修复的前置条件,也不修改 AGUI reasoning;本 PR 使用
a6899156不可变预览,是为了跟随该 PR 最新实现并同时覆盖用户需要的上传附件修复。当前状态
refA/B 验证;验证
pnpm install --frozen-lockfilepnpm run build:chatpnpm -C packages/tdesign-vue-next-chat/site buildgit diff --checkref+ 连续 THINKING CONTENT 的 A/B 浏览器验证📝 更新日志
tdesign-vue-next
无变更。
@tdesign-vue-next/chat
@tdesign-vue-next/nuxt
无变更。
@tdesign-vue-next/auto-import-resolver
无变更。
☑️ 请求合并前的自查清单